package tron

import (
	"context"
	"tronServer/utility/tron"

	"github.com/gogf/gf/v2/errors/gcode"
	"github.com/gogf/gf/v2/errors/gerror"

	"tronServer/api/tron/v1"
)

// TronUsdtBalanceQuery 查询usdt余额
func (c *ControllerV1) TronUsdtBalanceQuery(ctx context.Context, req *v1.TronUsdtBalanceQueryReq) (res *v1.TronUsdtBalanceQueryRes, err error) {
	var (
		balance string
	)

	// 检查钱包
	{
		if err = tron.Tron.CheckTrc20Address(ctx, req.Trc20Address); err != nil {
			return
		}
	}
	// 获取余额
	{
		if balance, err = tron.Query.GetUsdtBalance(ctx, req.Trc20Address); err != nil {
			return
		}
	}
	// 返回数据
	res = &v1.TronUsdtBalanceQueryRes{
		UsdtBalance: balance,
	}
	return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
